package com.chenggcode.mpsamples.service.impl;

import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chenggcode.mpsamples.persistence.domain.JsonInfo;
import com.chenggcode.mpsamples.persistence.domain.JsonbEntity;
import com.chenggcode.mpsamples.persistence.mapper.JsonbMapper;
import com.chenggcode.mpsamples.service.JsonbService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author chenggcode
 * @description 针对表【tb_jsonb(包含jsonb字段的表)】的数据库操作Service实现
 * @createDate 2025-07-03 11:42:57
 */
@Service
public class JsonbServiceImpl extends ServiceImpl<JsonbMapper, JsonbEntity>
        implements JsonbService {

    @Override
    public void save() {
        JsonInfo jsonInfo = new JsonInfo();
        jsonInfo.setName("chenggcode");
        jsonInfo.setAge(0);
        jsonInfo.setAddress(Map.of("city", "Beijing", "country", "China"));

        JsonbEntity jsonbEntity = new JsonbEntity();
        jsonbEntity.setJsonInfo1(jsonInfo);
        jsonbEntity.setJsonInfo2(jsonInfo);

        save(jsonbEntity);
    }
}




